package edu.szu.huhanpeng.doodlingFight.view.components 
{
	import com.aka.tools.funcTools.CountToCall;
	import com.bit101.components.Label;
	import com.bit101.components.Panel;
	import com.bit101.components.PushButton;
	import com.bit101.components.TextArea;
	import com.bit101.components.Window;
	import com.bit101.interfaces.IWindow;
	import edu.szu.huhanpeng.doodlingFight.globalConst.GlobalConst;
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	/**
	 * ...
	 * @author Huhanpeng
	 */
	public class MsgDlgBox extends Window 
	{
		protected static const V_GAP:int = 15; 
		
		protected static const TITLE:String = "用户信息";
		protected static const WINDOW_WIDTH:int = GlobalConst.setting.GOLDEN_WIDTH * 0.6;
		protected static const WINDOW_HEIGHT:int = GlobalConst.setting.GOLDEN_HEIGHT * 0.6;
		
		protected static const T_AREA_WIDTH:int = GlobalConst.setting.GOLDEN_WIDTH * 0.387;
		protected static const T_AREA_HEIGHT:int = GlobalConst.setting.GOLDEN_HEIGHT * 0.387;
		protected static const T_AREA_X:int = (WINDOW_WIDTH - T_AREA_WIDTH) / 2;
		protected static const T_AREA_Y:int = V_GAP;
		
		protected static const BTN_NAME:String = "确定";
		protected static const BTN_WIDTH:int = GlobalConst.setting.GOLDEN_WIDTH * 0.08;
		protected static const BTN_HEIGHT:int = GlobalConst.setting.GOLDEN_HEIGHT * 0.08;
		protected static const BTN_X:int = (WINDOW_WIDTH - BTN_WIDTH) / 2;
		protected static const BTN_Y:int = T_AREA_Y + T_AREA_HEIGHT + V_GAP;
		
		
		protected var _window:Window;
		protected var _txtArea:TextArea;
		protected var _btn:PushButton;
		
		protected var _callback:Function;
		protected var _callbackArgs:Array;
		

		
       		
		
		/////////////////////////////////////////////////////////////////////
		//构造函数                                                         //
		/////////////////////////////////////////////////////////////////////
		public function MsgDlgBox(parent:DisplayObjectContainer=null, xpos:Number=0, ypos:Number=0, title:String=TITLE) 
		{
			super(parent, xpos, ypos, title);
		}
		
		override protected function init():void 
		{
			super.init();
			setSize( WINDOW_WIDTH, WINDOW_HEIGHT );
			draggable = false;
			_txtArea = new TextArea( this, T_AREA_X, T_AREA_Y );
			_txtArea.setSize( T_AREA_WIDTH, T_AREA_HEIGHT );
			_txtArea.editable = false;
			_txtArea.selectable = false;
			_btn = new PushButton( this, BTN_X, BTN_Y, BTN_NAME, onClick )
			_btn.setSize( BTN_WIDTH, BTN_HEIGHT );
			trace(V_GAP);
		}
		
		
		
		/////////////////////////////////////////////////////////////////////
		//接口                                                             //
		/////////////////////////////////////////////////////////////////////
		public function setMsg(str:String):void
		{
			_txtArea.text = str;
		}
		
		public function setCallBack(func:Function):void 
		{
			_callback = func;
		}
		
		public function setFuncArgs(arr:Array):void
		{
			_callbackArgs = arr;
		}

		
		/////////////////////////////////////////////////////////////////////
		//getter setter                                                    //
		/////////////////////////////////////////////////////////////////////


		
		/////////////////////////////////////////////////////////////////////
		//内部                                                             //
		/////////////////////////////////////////////////////////////////////
		
		protected function onClick(e:MouseEvent):void 
		{
			if ( _callback != null ) 
			{
				_callback.apply( null, _callbackArgs );
			}
		}
		
	}

}